﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;
using System.Windows.Media;

namespace TestDxfDocument
{

    class _Polygonaltaperinterfacewithflangecontactsurface
    {
        public static void _PolygonaltaperinterfacewithflangecontactsurfaceFineshankedtaps(Dictionary<string, Object> data)//细柄丝锥
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            refin.Linetype = Linetype.Dashed;
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            centre.Linetype = Linetype.DashDot;
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层


            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);



            double scale = 1; //放大系数

            //double dc = Convert.ToDouble(data["dc"]) * scale;
            double b1 = Convert.ToDouble(data["b1"]) * scale;
            double b2 = Convert.ToDouble(data["b2"]) * scale;
            double b3 = Convert.ToDouble(data["b3"]) * scale;
            double b4 = Convert.ToDouble(data["b4"]) * scale;
            double b5 = Convert.ToDouble(data["b5"]) * scale;
            double b6 = Convert.ToDouble(data["b6"]) * scale;
            double b7 = Convert.ToDouble(data["b7"]) * scale;
            double b8 = Convert.ToDouble(data["b8"]) * scale;
            double d1 = Convert.ToDouble(data["d1"]) * scale;
            double d2 = Convert.ToDouble(data["d2"]) * scale;
            double d3 = Convert.ToDouble(data["d3"]) * scale;
            double d4 = Convert.ToDouble(data["d4"]) * scale;
            double d5 = Convert.ToDouble(data["d5"]) * scale;
            double d6 = Convert.ToDouble(data["d6"]) * scale;
            double d7 = Convert.ToDouble(data["d7"]) * scale;
            double d8 = Convert.ToDouble(data["d8"]) * scale;
            double d9 = Convert.ToDouble(data["d9"]) * scale;
            double d10 = Convert.ToDouble(data["d10"]) * scale;
            double d11 = Convert.ToDouble(data["d11"]) * scale;
            double dm = Convert.ToDouble(data["dm"]) * scale;
            double e = Convert.ToDouble(data["e"]) * scale;
            double f1 = Convert.ToDouble(data["f1"]) * scale;
            double h1 = Convert.ToDouble(data["h1"]) * scale;
            double h2 = Convert.ToDouble(data["h2"]) * scale;
            double h3 = Convert.ToDouble(data["h3"]) * scale;
            double l1 = Convert.ToDouble(data["l1"]) * scale;
            double l2 = Convert.ToDouble(data["l2"]) * scale;
            double l3 = Convert.ToDouble(data["l3"]) * scale;
            double l4 = Convert.ToDouble(data["l4"]) * scale;
            double l5 = Convert.ToDouble(data["l5"]) * scale;
            double l6 = Convert.ToDouble(data["l6"]) * scale;
            double l7 = Convert.ToDouble(data["l7"]) * scale;
            double l8 = Convert.ToDouble(data["l8"]) * scale;
            double l9 = Convert.ToDouble(data["l9"]) * scale;
            double l10 = Convert.ToDouble(data["l10"]) * scale;
            double l11 = Convert.ToDouble(data["l11"]) * scale;
            double l12 = Convert.ToDouble(data["l12"]) * scale;
            double l13 = Convert.ToDouble(data["l13"]) * scale;
            double l14 = Convert.ToDouble(data["l14"]) * scale;
            double l15 = Convert.ToDouble(data["l15"]) * scale;
            double l16 = Convert.ToDouble(data["l16"]) * scale;
            double r1 = Convert.ToDouble(data["r1"]) * scale;
            double r2 = Convert.ToDouble(data["r2"]) * scale;
            double r3 = Convert.ToDouble(data["r3"]) * scale;








            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X - (d1 / 2 + 2) / Math.Sin(45 * pi / 180), v1.Y);
            Vector2 v3 = new Vector2(v1.X + (d1 / 2 + 2) / Math.Sin(45 * pi / 180), v1.Y);
            Vector2 v4 = new Vector2(v3.X + d1 / 8, v3.Y);
            Vector2 v5 = new Vector2(v1.X, v1.Y - (d1 / 2 + 2) / Math.Sin(45 * pi / 180));
            Vector2 v6 = new Vector2(v1.X, v1.Y + (d1 / 2 + 2) / Math.Sin(45 * pi / 180));
            Vector2 v7 = fun.Polar(v3, 45 * pi / 180, d1 / 8);
            Vector2 v8 = fun.Polar(v3, -45 * pi / 180, d1 / 8);
            Vector2 v9 = fun.Polar(v5, -135 * pi / 180, d1 / 8);
            Vector2 v10 = fun.Polar(v2, -135 * pi / 180, d1 / 8);
            Vector2 v11 = fun.Polar(v2, 135 * pi / 180, d1 / 8);
            Vector2 v12 = fun.Polar(v6, 45 * pi / 180, d1 / 8);
            Vector2 v13 = fun.Polar(v6, 135 * pi / 180, d1 / 8);
            Vector2 v14 = fun.Polar(v1, -118 * pi / 180, 0.323 * d1);
            Vector2 v15 = fun.Polar(v14, 126 * pi / 180, 0.292 * d1);
            Vector2 v16 = fun.Polar(v15, 60 * pi / 180, 0.417 * d1);
            Vector2 v17 = fun.Polar(v16, 1 * pi / 180, 0.227 * d1);
            Vector2 v18 = fun.Polar(v17, -55 * pi / 180, 0.364 * d1);
            Vector2 v19 = fun.Polar(v18, -108 * pi / 180, 0.273 * d1);
            Vector2 v20 = fun.Polar(v1, -118 * pi / 180, 0.323 * d1 * 1.077);
            Vector2 v21 = fun.Polar(v20, 126 * pi / 180, 0.292 * d1 * 1.075);
            Vector2 v22 = fun.Polar(v21, 60 * pi / 180, 0.417 * d1 * 1.076);
            Vector2 v23 = fun.Polar(v22, 1 * pi / 180, 0.227 * d1 * 1.076);
            Vector2 v24 = fun.Polar(v23, -55 * pi / 180, 0.364 * d1 * 1.073);
            Vector2 v25 = fun.Polar(v24, -108 * pi / 180, 0.273 * d1 * 1.076);
            Vector2 v26 = fun.Polar(v1, 161 * pi / 180, d1 / 2);
            Vector2 v27 = fun.Polar(v1, 108 * pi / 180, d1 / 2);
            Vector2 v28 = fun.Polar(v1, 71 * pi / 180, d1 / 2);
            Vector2 v29 = fun.Polar(v1, 18 * pi / 180, d1 / 2);
            Vector2 v30 = fun.Polar(v1, -19 * pi / 180, d1 / 2);
            Vector2 v31 = fun.Polar(v1, -72 * pi / 180, d1 / 2);
            Vector2 v32 = fun.Polar(v1, -109 * pi / 180, d1 / 2);
            Vector2 v33 = fun.Polar(v1, -162 * pi / 180, d1 / 2);
            Vector2 v34 = fun.Polar(v28, 134 * pi / 180, d4 / 4);
            Vector2 v35 = fun.Polar(v29, -46 * pi / 180, d4 / 4);
            Vector2 v36 = fun.Polar(v35, 44 * pi / 180, d4 / 2);
            Vector2 v37 = fun.Polar(v34, 44 * pi / 180, d4 / 2);
            Vector2 v47 = new Vector2(v1.X, v1.Y - h1 - r1);
            Vector2 v01 = new Vector2(v47.X, v47.Y + r1);
            Vector2 v02 = new Vector2(v1.X + d1 / 2, v1.Y);
            Vector2 v03 = new Vector2(v1.X - d1 / 2, v1.Y);
            Vector2 v04 = new Vector2(v2.X + 1, v2.Y - 0.5);
            Vector2 v05 = new Vector2(v04.X + 3, v04.Y);
            Vector2 v06 = new Vector2(v6.X, v6.Y - 2);
            Vector2 v07 = new Vector2(v04.X + 1.5, v04.Y);
            Vector2 v08 = fun.Polar(v07, 113 * pi / 180, 8);
            Vector2 v09 = new Vector2(v5.X, v5.Y + 2);
            Vector2 v010 = fun.Polar(v47, 70 * pi / 180, r1);





            //2
            Vector2 v38 = fun.Polar(v1, 135 * pi / 180, d1 * 2);
            Vector2 v39 = fun.Polar(v38, -135 * pi / 180, d1 / 2 + d1 * 0.2);
            Vector2 v40 = fun.Polar(v38, 45 * pi / 180, d1 / 2 + d1 * 0.2);
            Vector2 v41 = fun.Polar(v38, -45 * pi / 180, l3);
            Vector2 v42 = fun.Polar(v38, 135 * pi / 180, d1 + d1 * 0.2);
            Vector2 v52 = fun.Polar(v38, -135 * pi / 180, d1 / 2);
            Vector2 v53 = fun.Polar(v38, 45 * pi / 180, d1 / 2);
            Vector2 v43 = fun.Polar(v52, 135 * pi / 180, l6);
            Vector2 v44 = fun.Polar(v53, 135 * pi / 180, l6);
            Vector2 v45 = fun.Polar(v43, 45 * pi / 180, (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2);
            Vector2 v46 = fun.Polar(v44, -135 * pi / 180, (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2);
            Vector2 v48 = fun.Polar(v45, 133.8 * pi / 180, d1 * 0.77 / 1.12 / Math.Cos(1.2 * pi / 180));
            Vector2 v49 = fun.Polar(v48, 45 * pi / 180, d1 * 0.77);
            Vector2 v50 = fun.Polar(v46, 136.2 * pi / 180, l1 * 3 / 4);
            Vector2 v51 = fun.Polar(v45, 133.8 * pi / 180, l1 * 3 / 4);
            Vector2 v58 = fun.Polar(v38, -135 * pi / 180, d1 * Math.Sin(26.5 * pi / 180) / 2);
            Vector2 v54 = fun.Polar(v58, 135 * pi / 180, (b1 - b3) / 8);
            Vector2 v55 = fun.Polar(v54, -45 * pi / 180, (b1 - b3) / 4);
            Vector2 v56 = fun.Polar(v55, 45 * pi / 180, d1 * Math.Sin(26.5 * pi / 180));
            Vector2 v57 = fun.Polar(v56, 135 * pi / 180, (b1 - b3) / 4);
            Vector2 v59 = fun.Polar(v53, 135 * pi / 180, (b1 - b3) / 4);
            Vector2 v60 = fun.Polar(v53, -45 * pi / 180, (b1 - b3) / 4);
            Vector2 v61 = fun.Polar(v44, -45 * pi / 180, l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180));
            Vector2 v62 = fun.Polar(v61, -45 * pi / 180, (b1 - b3) / 8 * Math.Sin(50 * pi / 180));
            Vector2 v63 = fun.Polar(v62, 35 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            Vector2 v64 = fun.Polar(v63, 35 * pi / 180, l3 / 2);
            Vector2 v65 = fun.Polar(v52, 135 * pi / 180, (b1 - b3) / 4);
            Vector2 v66 = fun.Polar(v52, -45 * pi / 180, (b1 - b3) / 4);
            Vector2 v67 = fun.Polar(v43, -45 * pi / 180, l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180));
            Vector2 v68 = fun.Polar(v67, -45 * pi / 180, (b1 - b3) / 8 * Math.Sin(50 * pi / 180));
            Vector2 v69 = fun.Polar(v68, -125 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            Vector2 v70 = fun.Polar(v69, -125 * pi / 180, l3 / 2);
            Vector2 v71 = fun.Polar(v68, 45 * pi / 180, 0.5);
            Vector2 v72 = fun.Polar(v62, -135 * pi / 180, 0.5);
            Vector2 v011 = fun.Polar(v53, 45 * pi / 180, (b1 - b3) / 2);
            Vector2 v012 = fun.Polar(v52, -135 * pi / 180, (b1 - b3) / 4);
            Vector2 v013 = fun.Polar(v52, 45 * pi / 180, (b1 - b3) / 4);
            Vector2 v014 = fun.Polar(v53, -135 * pi / 180, (b1 - b3) / 4);
            Vector2 v015 = fun.Polar(v53, 45 * pi / 180, (b1 - b3) / 4);
            Vector2 v016 = fun.Polar(v52, -85 * pi / 180, (b1 - b3) / 2);
            Vector2 v017 = fun.Polar(v016, -67 * pi / 180, b1 - b3);






            //3
            Vector2 v73 = new Vector2(v1.X + d1 * 5 / 2, v1.Y);
            Vector2 v74 = new Vector2(v73.X - l3, v73.Y);
            Vector2 v75 = new Vector2(v73.X + d1 + d1 * 0.2, v73.Y);
            Vector2 v76 = new Vector2(v73.X, v73.Y - d1 / 2 - d1 * 0.2);
            Vector2 v77 = new Vector2(v73.X, v73.Y + d1 / 2 + d1 * 0.2);
            Vector2 v78 = new Vector2(v73.X, v73.Y + d1 / 2);
            Vector2 v79 = new Vector2(v73.X, v73.Y - d1 / 2);
            Vector2 v80 = new Vector2(v78.X + l6, v78.Y);
            Vector2 v81 = new Vector2(v79.X + l6, v79.Y);
            Vector2 v82 = new Vector2(v81.X, v81.Y + (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2);
            Vector2 v83 = new Vector2(v80.X, v80.Y - (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2 - l1 * 3 / 8);
            Vector2 v88 = fun.Polar(v82, 1.2 * pi / 180, (d1 * 0.77 / 1.12 - l4) / Math.Cos(1.2 * pi / 180));
            Vector2 v87 = fun.Polar(v88, 30 * pi / 180, l4 / Math.Cos(30 * pi / 180));
            Vector2 v121 = new Vector2(v80.X, v80.Y - (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2);
            Vector2 v84 = fun.Polar(v121, -1.2 * pi / 180, l1 * 3 / 4);
            Vector2 v85 = fun.Polar(v121, -1.2 * pi / 180, (d1 * 0.77 / 1.12 - l4) / Math.Cos(1.2 * pi / 180));
            Vector2 v86 = fun.Polar(v85, -30 * pi / 180, l4 / Math.Cos(30 * pi / 180));
            Vector2 v91 = fun.Polar(v82, 1.2 * pi / 180, l1 * 3 / 4);
            Vector2 v96 = new Vector2(v81.X - (l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180)), v81.Y);
            Vector2 v97 = new Vector2(v96.X - (b1 - b3) / 8 * Math.Sin(50 * pi / 180), v96.Y);
            Vector2 v98 = fun.Polar(v97, -100 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            Vector2 v99 = fun.Polar(v98, -100 * pi / 180, l3 / 2);
            Vector2 v100 = new Vector2(v80.X - (l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180)), v80.Y);
            Vector2 v101 = new Vector2(v100.X - (b1 - b3) / 8 * Math.Sin(50 * pi / 180), v100.Y);
            Vector2 v102 = fun.Polar(v101, 100 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            Vector2 v103 = fun.Polar(v102, 100 * pi / 180, l3 / 2);
            Vector2 v104 = new Vector2(v73.X + l6 + l1, v73.Y);
            Vector2 v105 = new Vector2(v104.X, v104.Y - d1 / 2 + 3);
            Vector2 v106 = new Vector2(v104.X, v104.Y + d1 / 2 - 3);
            Vector2 v107 = new Vector2(v73.X, v73.Y + d1 / 2 * 0.3);
            Vector2 v108 = new Vector2(v107.X + (b1 - b3) / 8, v107.Y);
            Vector2 v111 = new Vector2(v107.X - (b1 - b3) / 8, v107.Y);
            Vector2 v110 = new Vector2(v111.X, v111.Y + d1 / 2 - d1 / 2 * 0.3 - 0.5);
            Vector2 v109 = new Vector2(v108.X, v108.Y + d1 / 2 - d1 / 2 * 0.3 - 0.5);
            Vector2 v112 = new Vector2(v73.X, v73.Y - d1 / 2 * 0.3);
            Vector2 v113 = new Vector2(v112.X + (b1 - b3) / 8, v112.Y);
            Vector2 v114 = new Vector2(v113.X, v113.Y - (d1 / 2 - d1 / 2 * 0.3 - 0.5));
            Vector2 v116 = new Vector2(v112.X - (b1 - b3) / 8, v112.Y);
            Vector2 v115 = new Vector2(v116.X, v116.Y - (d1 / 2 - d1 / 2 * 0.3 - 0.5));
            Vector2 v117 = new Vector2(v83.X, v83.Y - l1 * 3 / 8);
            Vector2 v118 = new Vector2(v82.X, v82.Y + (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77) / 2.82);
            Vector2 v119 = new Vector2(v82.X, v82.Y + (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77) / 10.17);
            Vector2 v90 = fun.Polar(v82, 1.2 * pi / 180, (d1 * 0.77 / 1.12 / Math.Cos(1.2 * pi / 180)) / 1.57);
            Vector2 v120 = new Vector2(v90.X, v87.Y);
            Vector2 v92 = fun.Polar(v120, 50 * pi / 180, l4 / Math.Cos(30 * pi / 180));
            Vector2 v93 = new Vector2(v87.X, v87.Y + l4 / Math.Cos(30 * pi / 180) * Math.Sin(50 * pi / 180));
            Vector2 v89 = fun.Polar(v90, 1.2 * pi / 180, (d1 * 0.77 / 1.12 / Math.Cos(1.2 * pi / 180)) / 5.64);
            Vector2 v94 = new Vector2(v89.X, v87.Y);
            Vector2 v95 = new Vector2(v85.X, v93.Y);
            Vector2 v122 = new Vector2(v101.X, v101.Y - 0.5);
            Vector2 v123 = new Vector2(v97.X, v97.Y + 0.5);
            Vector2 v018 = new Vector2(v101.X, v101.Y + 0.7);





            //4
            Vector2 v124 = new Vector2(v73.X, v73.Y + d1 * 2.5);
            Vector2 v125 = new Vector2(v124.X, v124.Y + d1 / 2 + d1 * 0.2);
            Vector2 v126 = new Vector2(v124.X, v124.Y - d1 / 2 - d1 * 0.2);
            Vector2 v127 = new Vector2(v124.X - l3, v124.Y);
            Vector2 v128 = new Vector2(v124.X + d1 + d1 * 0.2, v124.Y);
            Vector2 v129 = new Vector2(v124.X, v124.Y + d1 / 2);
            Vector2 v130 = new Vector2(v124.X, v124.Y - d1 / 2);
            Vector2 v131 = new Vector2(v129.X + l6, v129.Y);
            Vector2 v132 = new Vector2(v130.X + l6, v130.Y);
            Vector2 v133 = new Vector2(v124.X, v124.Y + d1 / 2 * 0.3);
            Vector2 v134 = new Vector2(v133.X + (b1 - b3) / 8, v133.Y);
            Vector2 v135 = new Vector2(v134.X, v134.Y + d1 / 2 - d1 / 2 * 0.3 - 0.5);
            Vector2 v137 = new Vector2(v133.X - (b1 - b3) / 8, v133.Y);
            Vector2 v136 = new Vector2(v137.X, v137.Y + d1 / 2 - d1 / 2 * 0.3 - 0.5);
            Vector2 v138 = new Vector2(v124.X, v124.Y - d1 / 2 * 0.3);
            Vector2 v139 = new Vector2(v138.X + (b1 - b3) / 8, v138.Y);
            Vector2 v140 = new Vector2(v139.X, v139.Y - (d1 / 2 - d1 / 2 * 0.3 - 0.5));
            Vector2 v142 = new Vector2(v138.X - (b1 - b3) / 8, v138.Y);
            Vector2 v141 = new Vector2(v142.X, v142.Y - (d1 / 2 - d1 / 2 * 0.3 - 0.5));
            Vector2 v143 = new Vector2(v131.X - (l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180)), v131.Y);
            Vector2 v144 = new Vector2(v143.X - (b1 - b3) / 8 * Math.Sin(50 * pi / 180), v143.Y);
            Vector2 v145 = fun.Polar(v144, 100 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            Vector2 v146 = fun.Polar(v145, 100 * pi / 180, l3 / 2);
            Vector2 v147 = new Vector2(v132.X - (l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180)), v132.Y);
            Vector2 v148 = new Vector2(v147.X - (b1 - b3) / 8 * Math.Sin(50 * pi / 180), v147.Y);
            Vector2 v149 = fun.Polar(v148, -100 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            Vector2 v150 = fun.Polar(v149, -100 * pi / 180, l3 / 2);
            Vector2 v151 = new Vector2(v144.X, v144.Y - 0.5);
            Vector2 v152 = new Vector2(v148.X, v148.Y + 0.5);
            Vector2 v153 = new Vector2(v131.X, v131.Y - (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2 - l1 * 3 / 4 / 5);
            Vector2 v171 = new Vector2(v131.X, v131.Y - (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2);
            Vector2 v155 = fun.Polar(v171, -1.2 * pi / 180, l1 * 3 / 4);
            Vector2 v154 = new Vector2(v155.X, v153.Y);
            Vector2 v156 = fun.Polar(v171, -1.2 * pi / 180, d1 * 0.77 / 1.12 / Math.Cos(1.2 * pi / 180));
            Vector2 v172 = new Vector2(v132.X, v132.Y + (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2);
            Vector2 v158 = fun.Polar(v172, 1.2 * pi / 180, l1 * 3 / 4);
            Vector2 v160 = new Vector2(v132.X, v132.Y + (d1 - (d1 * 0.77 / 1.12 * Math.Tan(1.2 * pi / 180) * 2 + d1 * 0.77)) / 2 + l1 * 3 / 4 / 5);
            Vector2 v159 = new Vector2(v158.X, v160.Y);
            Vector2 v157 = fun.Polar(v172, 1.2 * pi / 180, d1 * 0.77 / 1.12 / Math.Cos(1.2 * pi / 180));
            Vector2 v161 = new Vector2(v153.X, v153.Y - l1 * 3 / 4 * 2.33);
            Vector2 v162 = new Vector2(v153.X + l1 * 3 / 4 / 1.877, v153.Y);
            Vector2 v163 = new Vector2(v160.X, v160.Y + l1 * 3 / 4 * 2.33);
            Vector2 v164 = new Vector2(v160.X + l1 * 3 / 4 / 1.877, v160.Y);
            Vector2 v165 = new Vector2(v124.X + l6 + l10, v124.Y);
            Vector2 v166 = new Vector2(v132.X + l11, v124.Y);
            Vector2 v173 = new Vector2(v166.X + b4 / 2, v166.Y);
            Vector2 v167 = new Vector2(v173.X, v173.Y + b4 / 2);
            Vector2 v168 = new Vector2(v156.X, v167.Y);
            Vector2 v170 = new Vector2(v173.X, v173.Y - b4 / 2);
            Vector2 v169 = new Vector2(v156.X, v170.Y);
            Vector2 v174 = new Vector2(v132.X - l9, v124.X);
            Vector2 v019 = new Vector2(v165.X, v165.Y + b4 / 2);
            Vector2 v020 = new Vector2(v165.X, v165.Y - b4 / 2);
            Vector2 v021 = new Vector2(v165.X - b5 / 2, v165.Y);
            Vector2 v022 = new Vector2(v165.X + b5 / 2, v165.Y);


            //5
            Vector2 v175 = new Vector2(v124.Y - d1, v124.X);
            Vector2 v176 = fun.Polar(v175, 30 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3);
            Vector2 v177 = new Vector2(v176.X, v176.Y + l4 / Math.Cos(30 * pi / 180) * 12);
            Vector2 v178 = new Vector2(v175.X - l4 / Math.Cos(30 * pi / 180) * 24, v175.Y);
            Vector2 v179 = fun.Polar(v178, 90 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 0.31);
            Vector2 v180 = fun.Polar(v179, 52 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 1.41);
            Vector2 v181 = fun.Polar(v180, 42 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 0.59);
            Vector2 v182 = fun.Polar(v181, 42 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 0.64);
            Vector2 v183 = fun.Polar(v182, 36 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 1.15);
            Vector2 v184 = fun.Polar(v183, 28 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 1.31);
            Vector2 v185 = fun.Polar(v184, 14 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 1.07);
            Vector2 v186 = fun.Polar(v185, 12 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 1.07);
            Vector2 v187 = fun.Polar(v177, -169 * pi / 180, l4 / Math.Cos(30 * pi / 180) * 3 * 0.85);
            Vector2 v190 = new Vector2(v176.X, v176.Y + l4 / Math.Cos(30 * pi / 180) * 3);
            Vector2 v189 = new Vector2(v190.X - l5 * 3, v190.Y);
            Vector2 v188 = fun.Polar(v189, -135 * pi / 180, (v189.Y - v175.Y) / Math.Sin(45 * pi / 180));
            Vector2 v023 = new Vector2(v189.X, v188.Y);



            //6
            //Vector2 v191 = new Vector2(v5.X, v5.Y - d1 * 3);
            //Vector2 v192 = new Vector2(v191.X, v191.Y + d1 / 2 - 3);
            //Vector2 v193 = new Vector2(v191.X, v191.Y - d1 / 2 - 3);
            //Vector2 v194 = new Vector2(v191.X - l10 - l3 * 2, v191.Y);
            //Vector2 v195 = new Vector2(v191.X + (v128.X - v165.X), v191.Y);
            //Vector2 v196 = new Vector2(v191.X + (v168.X - v165.X), v195.Y);
            //Vector2 v197 = new Vector2(v196.X, v196.Y + d1 * 0.77 / 2);
            //Vector2 v198 = fun.Polar(v197, 150 * pi / 180, l4 / Math.Cos(30 * pi / 180));
            //Vector2 v199 = new Vector2(v196.X, v196.Y - d1 * 0.77 / 2);
            //Vector2 v200 = fun.Polar(v199, -150 * pi / 180, l4 / Math.Cos(30 * pi / 180));
            //Vector2 v202 = new Vector2(v191.X - l10, v200.Y);
            //Vector2 v203 = new Vector2(v202.X, v202.Y - (d1 - d1 * 0.77) / 2);
            //Vector2 v204 = new Vector2(v203.X - (l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180)), v203.Y);
            //Vector2 v237 = new Vector2(v204.X - (b1 - b3) / 8 * Math.Sin(50 * pi / 180), v204.Y);
            //Vector2 v205 = fun.Polar(v237, -100 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            //Vector2 v206 = fun.Polar(v205, -100 * pi / 180, l3 / 2);
            //Vector2 v207 = new Vector2(v206.X - l3 / 9, v206.Y);
            //Vector2 v208 = fun.Polar(v207, 104 * pi / 180, l3 / 12.86);
            //Vector2 v209 = fun.Polar(v208, 97 * pi / 180, l3 / 8.5);
            //Vector2 v210 = fun.Polar(v209, 97 * pi / 180, l3 / 15);
            //Vector2 v211 = fun.Polar(v210, 85 * pi / 180, l3 / 4.33);
            //Vector2 v212 = fun.Polar(v211, 85 * pi / 180, l3 / 4.85);
            //Vector2 v213 = fun.Polar(v212, 89 * pi / 180, l3 / 6.19);
            //Vector2 v214 = fun.Polar(v213, 91 * pi / 180, l3 / 6.06);
            //Vector2 v215 = fun.Polar(v214, 92 * pi / 180, l3 / 3.82);
            //Vector2 v216 = fun.Polar(v215, 97 * pi / 180, l3 / 4.4);
            //Vector2 v217 = fun.Polar(v216, 94 * pi / 180, l3 / 7.93);
            //Vector2 v218 = fun.Polar(v217, 88 * pi / 180, l3 / 7.66);
            //Vector2 v219 = fun.Polar(v218, 86 * pi / 180, l3 / 5);
            //Vector2 v220 = fun.Polar(v219, 89 * pi / 180, l3 / 5.71);
            //Vector2 v221 = fun.Polar(v220, 90 * pi / 180, l3 / 7.41);
            //Vector2 v222 = fun.Polar(v221, 88 * pi / 180, l3 / 5.86);
            //Vector2 v223 = fun.Polar(v222, 93 * pi / 180, l3 / 5.42);
            //Vector2 v224 = fun.Polar(v223, 90 * pi / 180, l3 / 4.89);
            //Vector2 v225 = fun.Polar(v224, 93 * pi / 180, l3 / 6.84);
            //Vector2 v226 = fun.Polar(v225, 79 * pi / 180, l3 / 10.78);
            //Vector2 v227 = fun.Polar(v226, 89 * pi / 180, l3 / 4.26);
            //Vector2 v228 = fun.Polar(v227, 89 * pi / 180, l3 / 8.76);
            //Vector2 v229 = fun.Polar(v228, 89 * pi / 180, l3 / 5.29);
            //Vector2 v234 = fun.Polar(v203, 90 * pi / 180, d1);
            //Vector2 v233 = fun.Polar(v234, 180 * pi / 180, l3 - (b1 - b3) / 8 * Math.Sin(50 * pi / 180));
            //Vector2 v232 = fun.Polar(v233, 180 * pi / 180, (b1 - b3) / 8 * Math.Sin(50 * pi / 180));
            //Vector2 v231 = fun.Polar(v232, 100 * pi / 180, (b1 - b3) / 8 * Math.Tan(40 * pi / 180));
            //Vector2 v230 = fun.Polar(v231, 100 * pi / 180, l3 / 2);
            //Vector2 v235 = new Vector2(v234.X, v198.Y);
            //Vector2 v236 = fun.Polar(v235, -135 * pi / 180, 0.4 / Math.Sin(45 * pi / 180));
            //Vector2 v238 = fun.Polar(v236, -45 * pi / 180, 1.5);
            //Vector2 v239 = new Vector2(v238.X + (v235.Y - v238.Y) * Math.Tan(45 * pi / 180), v198.Y);
            //Vector2 v240 = new Vector2(v199.X, v199.Y + l5 / 10);
            //Vector2 v241 = new Vector2(v240.X - l5, v240.Y);
            //Vector2 v243 = new Vector2(v241.X, v200.Y);
            //Vector2 v242 = new Vector2(v243.X - (v241.Y - v243.Y), v243.Y);
            //Vector2 v244 = new Vector2(v240.X, v196.Y - d3 / 2);
            //Vector2 v245 = new Vector2(v240.X, v196.Y + d3 / 2);
            //Vector2 v249 = new Vector2(v202.X + l11, v196.Y - d2 / 2);
            //Vector2 v246 = new Vector2(v245.X - (v245.X - v249.X) / 2, v196.Y + d2 / 2);
            //Vector2 v247 = new Vector2(v246.X, v196.Y - d2 / 2);
            //Vector2 v248 = new Vector2(v247.X - (v247.X - v249.X) * 1 / 3, v247.Y);
            //Vector2 v250 = new Vector2(v249.X - (v248.X - v249.X), v248.Y);
            //Vector2 v251 = new Vector2(v248.X, v246.Y);
            //Vector2 v252 = new Vector2(v249.X, v251.Y);
            //Vector2 v253 = new Vector2(v250.X, v252.Y);
            //Vector2 v254 = new Vector2(v202.X + l7, v250.Y);
            //Vector2 v255 = new Vector2(v254.X, v253.Y);
            //Vector2 v256 = fun.Polar(v255, 0 * pi / 180, 0.5);
            //Vector2 v257 = fun.Polar(v254, 0 * pi / 180, 0.5);
            //Vector2 v258 = new Vector2(v191.X - d5 / 2, v254.Y);
            //Vector2 v259 = new Vector2(v191.X + d5 / 2, v254.Y);
            //Vector2 v260 = new Vector2(v258.X, v243.Y);
            //Vector2 v261 = new Vector2(v259.X, v243.Y);
            //Vector2 v262 = new Vector2(v258.X, v253.Y);
            //Vector2 v263 = new Vector2(v259.X, v253.Y);
            //Vector2 v264 = new Vector2(v263.X, v191.Y + h2);
            //Vector2 v265 = new Vector2(v264.X - (v264.X - v191.X) * 2, v264.Y);
            //Vector2 v266 = new Vector2(v191.X, v265.Y + (v264.Y - v263.Y));
            //Vector2 v267 = new Vector2(v255.X, v191.Y + d4 / 2 - 0.5);
            //Vector2 v268 = new Vector2(v255.X, v191.Y - d4 / 2 + 0.5);
            //Vector2 v269 = new Vector2(v268.X - (l8 + l7) * 3 / 2, v268.Y);
            //Vector2 v270 = new Vector2(v268.X - (l8 + l7) * 3 / 2, v267.Y);
            //Vector2 v271 = new Vector2(v269.X - (l8 + l7) / 4, v191.Y);
            //Vector2 v272 = new Vector2(v203.X - l16, v203.Y);
            //Vector2 v276 = new Vector2(v272.X + 5, v272.Y);
            //Vector2 v275 = new Vector2(v272.X - 5, v272.Y);






            //作图
            //1
            Line line1 = new Line(v2, v4);
            line1.Layer = centre;
            line1.Linetype = Linetype.DashDot;
            line1.LinetypeScale = 3;
            dxf.AddEntity(line1);

            Line line2 = new Line(v5, v6);
            line2.Layer = centre;
            line2.Linetype = Linetype.DashDot;
            line2.LinetypeScale = 3;
            dxf.AddEntity(line2);

            Line line3 = new Line(v7, v9);
            line3.Layer = centre;
            line3.Linetype = Linetype.DashDot;
            line3.LinetypeScale = 3;
            dxf.AddEntity(line3);

            Line line4 = new Line(v11, v5);
            line4.Layer = centre;
            line4.Linetype = Linetype.DashDot;
            line4.LinetypeScale = 3;
            dxf.AddEntity(line4);

            Line line5 = new Line(v10, v12);
            line5.Layer = centre;
            line5.Linetype = Linetype.DashDot;
            line5.LinetypeScale = 3;
            dxf.AddEntity(line5);

            Line line6 = new Line(v13, v8);
            line6.Layer = centre;
            line6.Linetype = Linetype.DashDot;
            line6.LinetypeScale = 3;
            dxf.AddEntity(line6);

            fun.drawcircle(dxf, v1, d4 / 2, 0.3, contour);

            fun.drawcircle(dxf, v1, d2 / 2, 0.3, contour);

            fun.drawcircle(dxf, v1, d3 / 2, 0.3, contour);

            fun.drawcircle(dxf, v1, d1 / 2 * 0.77, 0.3, contour);

            fun.drawcircle(dxf, v1, d1 / 2, 0.3, contour);

            LwPolyline line7 = new LwPolyline();
            line7.Vertexes.Add(new LwPolylineVertex(v14));
            line7.Vertexes.Add(new LwPolylineVertex(v15));
            line7.Vertexes.Add(new LwPolylineVertex(v16));
            line7.Vertexes.Add(new LwPolylineVertex(v17));
            line7.Vertexes.Add(new LwPolylineVertex(v18));
            line7.Vertexes.Add(new LwPolylineVertex(v19));
            line7.Vertexes.Add(new LwPolylineVertex(v14));
            line7.Vertexes[0].Bulge = Math.Tan(-78 * pi / 180 / 4);
            line7.Vertexes[1].Bulge = Math.Tan(-52 * pi / 180 / 4);
            line7.Vertexes[2].Bulge = Math.Tan(-79 * pi / 180 / 4);
            line7.Vertexes[3].Bulge = Math.Tan(-41 * pi / 180 / 4);
            line7.Vertexes[4].Bulge = Math.Tan(-71 * pi / 180 / 4);
            line7.Vertexes[5].Bulge = Math.Tan(-47 * pi / 180 / 4);
            fun.PolyFill(dxf, line7, 0.3, contour);

            LwPolyline line8 = new LwPolyline();
            line8.Vertexes.Add(new LwPolylineVertex(v20));
            line8.Vertexes.Add(new LwPolylineVertex(v21));
            line8.Vertexes.Add(new LwPolylineVertex(v22));
            line8.Vertexes.Add(new LwPolylineVertex(v23));
            line8.Vertexes.Add(new LwPolylineVertex(v24));
            line8.Vertexes.Add(new LwPolylineVertex(v25));
            line8.Vertexes.Add(new LwPolylineVertex(v20));
            line8.Vertexes[0].Bulge = Math.Tan(-78 * pi / 180 / 4);
            line8.Vertexes[1].Bulge = Math.Tan(-52 * pi / 180 / 4);
            line8.Vertexes[2].Bulge = Math.Tan(-79 * pi / 180 / 4);
            line8.Vertexes[3].Bulge = Math.Tan(-41 * pi / 180 / 4);
            line8.Vertexes[4].Bulge = Math.Tan(-71 * pi / 180 / 4);
            line8.Vertexes[5].Bulge = Math.Tan(-47 * pi / 180 / 4);
            fun.PolyFill(dxf, line8, 0.3, contour);

            LwPolyline line9 = new LwPolyline();
            line9.Vertexes.Add(new LwPolylineVertex(v21));
            line9.Vertexes.Add(new LwPolylineVertex(v22));
            line9.Vertexes[0].Bulge = Math.Tan(-75 * pi / 180 / 4);
            fun.PolyFill(dxf, line9, 0.3, contour);

            LwPolyline line10 = new LwPolyline();
            line10.Vertexes.Add(new LwPolylineVertex(v23));
            line10.Vertexes.Add(new LwPolylineVertex(v24));
            line10.Vertexes[0].Bulge = Math.Tan(-64 * pi / 180 / 4);
            fun.PolyFill(dxf, line10, 0.3, contour);

            Line line11 = new Line(v26, v27);
            line11.Layer = refin;
            line11.Linetype = Linetype.Dashed;
            line11.LinetypeScale = 5;
            dxf.AddEntity(line11);

            Line line12 = new Line(v28, v29);
            line12.Layer = refin;
            line12.Linetype = Linetype.Dashed;
            line12.LinetypeScale = 5;
            dxf.AddEntity(line12);

            Line line13 = new Line(v30, v31);
            line13.Layer = refin;
            line13.Linetype = Linetype.Dashed;
            line13.LinetypeScale = 5;
            dxf.AddEntity(line13);

            Line line14 = new Line(v32, v33);
            line14.Layer = refin;
            line14.Linetype = Linetype.Dashed;
            line14.LinetypeScale = 5;
            dxf.AddEntity(line14);

            Line line15 = new Line(v34, v35);
            line15.Layer = centre;
            line15.Linetype = Linetype.DashDot;
            line15.LinetypeScale = 3;
            dxf.AddEntity(line15);

            Line line115 = new Line(v35, v36);
            line115.Layer = centre;
            line115.Linetype = Linetype.DashDot;
            line115.LinetypeScale = 3;
            dxf.AddEntity(line115);

            Line line215 = new Line(v36, v37);
            line215.Layer = centre;
            line215.Linetype = Linetype.DashDot;
            line215.LinetypeScale = 3;
            dxf.AddEntity(line215);

            Line line315 = new Line(v34, v37);
            line315.Layer = centre;
            line315.Linetype = Linetype.DashDot;
            line315.LinetypeScale = 3;
            dxf.AddEntity(line315);

            Arc arc1 = new Arc(v47, r1, 0, 180);
            arc1.Layer = contour;
            arc1.Lineweight = Lineweight.W50;
            dxf.AddEntity(arc1);


            //2
            Line line16 = new Line(v41, v42);
            line16.Layer = centre;
            line16.Linetype = Linetype.DashDot;
            line16.LinetypeScale = 3;
            dxf.AddEntity(line16);

            Line line17 = new Line(v39, v40);
            line17.Layer = centre;
            line17.Linetype = Linetype.DashDot;
            line17.LinetypeScale = 3;
            dxf.AddEntity(line17);


            fun.drawcircle(dxf, v52, (b1 - b3) / 4, 0.3, contour);

            fun.drawcircle(dxf, v53, (b1 - b3) / 4, 0.3, contour);

            fun.drawcircle(dxf, v52, (b1 - b3) / 2, 0.1, dimensioning);

            LwPolyline line18 = new LwPolyline();
            line18.Vertexes.Add(new LwPolylineVertex(v70));
            line18.Vertexes.Add(new LwPolylineVertex(v69));
            line18.Vertexes.Add(new LwPolylineVertex(v67));
            line18.Vertexes.Add(new LwPolylineVertex(v66));
            line18.Vertexes[1].Bulge = Math.Tan(75 * pi / 180 / 4);
            fun.PolyFill(dxf, line18, 0.3, contour);

            LwPolyline line19 = new LwPolyline();
            line19.Vertexes.Add(new LwPolylineVertex(v65));
            line19.Vertexes.Add(new LwPolylineVertex(v43));
            line19.Vertexes.Add(new LwPolylineVertex(v44));
            line19.Vertexes.Add(new LwPolylineVertex(v59));
            fun.PolyFill(dxf, line19, 0.3, contour);

            LwPolyline line20 = new LwPolyline();
            line20.Vertexes.Add(new LwPolylineVertex(v64));
            line20.Vertexes.Add(new LwPolylineVertex(v63));
            line20.Vertexes.Add(new LwPolylineVertex(v61));
            line20.Vertexes.Add(new LwPolylineVertex(v60));
            line20.Vertexes[1].Bulge = Math.Tan(-75 * pi / 180 / 4);
            fun.PolyFill(dxf, line20, 0.3, contour);

            LwPolyline line21 = new LwPolyline();
            line21.Vertexes.Add(new LwPolylineVertex(v45));
            line21.Vertexes.Add(new LwPolylineVertex(v48));
            line21.Vertexes.Add(new LwPolylineVertex(v49));
            line21.Vertexes.Add(new LwPolylineVertex(v46));
            line21.Vertexes.Add(new LwPolylineVertex(v50));
            line21.Vertexes.Add(new LwPolylineVertex(v51));
            fun.PolyFill(dxf, line21, 0.3, contour);

            LwPolyline line22 = new LwPolyline();
            line22.Vertexes.Add(new LwPolylineVertex(v54));
            line22.Vertexes.Add(new LwPolylineVertex(v55));
            line22.Vertexes.Add(new LwPolylineVertex(v56));
            line22.Vertexes.Add(new LwPolylineVertex(v57));
            line22.Vertexes.Add(new LwPolylineVertex(v54));
            line22.Vertexes.Add(new LwPolylineVertex(v57));
            line22.Vertexes[4].Bulge = Math.Tan(-31 * pi / 180 / 4);
            fun.PolyFill(dxf, line22, 0.3, contour);

            LwPolyline line23 = new LwPolyline();
            line23.Vertexes.Add(new LwPolylineVertex(v55));
            line23.Vertexes.Add(new LwPolylineVertex(v56));
            line23.Vertexes[0].Bulge = Math.Tan(31 * pi / 180 / 4);
            fun.PolyFill(dxf, line23, 0.3, contour);

            LwPolyline line24 = new LwPolyline();
            line24.Vertexes.Add(new LwPolylineVertex(v71));
            line24.Vertexes.Add(new LwPolylineVertex(v72));
            fun.PolyFill(dxf, line24, 0.3, contour);



            //3
            LwPolyline line25 = new LwPolyline();
            line25.Vertexes.Add(new LwPolylineVertex(v103));
            line25.Vertexes.Add(new LwPolylineVertex(v102));
            line25.Vertexes.Add(new LwPolylineVertex(v100));
            line25.Vertexes.Add(new LwPolylineVertex(v80));
            line25.Vertexes.Add(new LwPolylineVertex(v81));
            line25.Vertexes.Add(new LwPolylineVertex(v96));
            line25.Vertexes.Add(new LwPolylineVertex(v98));
            line25.Vertexes.Add(new LwPolylineVertex(v99));
            line25.Vertexes[1].Bulge = Math.Tan(75 * pi / 180 / 4);
            line25.Vertexes[5].Bulge = Math.Tan(75 * pi / 180 / 4);
            fun.PolyFill(dxf, line25, 0.3, contour);

            LwPolyline line26 = new LwPolyline();
            line26.Vertexes.Add(new LwPolylineVertex(v83));
            line26.Vertexes.Add(new LwPolylineVertex(v84));
            line26.Vertexes.Add(new LwPolylineVertex(v85));
            line26.Vertexes.Add(new LwPolylineVertex(v86));
            line26.Vertexes.Add(new LwPolylineVertex(v87));
            line26.Vertexes.Add(new LwPolylineVertex(v88));
            line26.Vertexes.Add(new LwPolylineVertex(v82));
            line26.Vertexes.Add(new LwPolylineVertex(v91));
            line26.Vertexes.Add(new LwPolylineVertex(v84));
            line26.Vertexes[0].Bulge = Math.Tan(57 * pi / 180 / 4);
            fun.PolyFill(dxf, line26, 0.3, contour);

            Line line27 = new Line(v74, v75);
            line27.Layer = centre;
            line27.Linetype = Linetype.DashDot;
            line27.LinetypeScale = 3;
            dxf.AddEntity(line27);

            Line line28 = new Line(v76, v77);
            line28.Layer = centre;
            line28.Linetype = Linetype.DashDot;
            line28.LinetypeScale = 3;
            dxf.AddEntity(line28);

            Line line29 = new Line(v105, v106);
            line29.Layer = centre;
            line29.Linetype = Linetype.DashDot;
            line29.LinetypeScale = 3;
            dxf.AddEntity(line29);

            LwPolyline line30 = new LwPolyline();
            line30.Vertexes.Add(new LwPolylineVertex(v111));
            line30.Vertexes.Add(new LwPolylineVertex(v108));
            line30.Vertexes.Add(new LwPolylineVertex(v109));
            line30.Vertexes.Add(new LwPolylineVertex(v110));
            line30.Vertexes.Add(new LwPolylineVertex(v111));
            line30.Vertexes.Add(new LwPolylineVertex(v110));
            line30.Vertexes[4].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line30, 0.3, contour);

            LwPolyline line31 = new LwPolyline();
            line31.Vertexes.Add(new LwPolylineVertex(v109));
            line31.Vertexes.Add(new LwPolylineVertex(v108));
            line31.Vertexes[0].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line31, 0.3, contour);

            LwPolyline line32 = new LwPolyline();
            line32.Vertexes.Add(new LwPolylineVertex(v115));
            line32.Vertexes.Add(new LwPolylineVertex(v114));
            line32.Vertexes.Add(new LwPolylineVertex(v113));
            line32.Vertexes.Add(new LwPolylineVertex(v116));
            line32.Vertexes.Add(new LwPolylineVertex(v115));
            line32.Vertexes.Add(new LwPolylineVertex(v116));
            line32.Vertexes[4].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line32, 0.3, contour);

            LwPolyline line33 = new LwPolyline();
            line33.Vertexes.Add(new LwPolylineVertex(v113));
            line33.Vertexes.Add(new LwPolylineVertex(v114));
            line33.Vertexes[0].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line33, 0.3, contour);

            LwPolyline line34 = new LwPolyline();
            line34.Vertexes.Add(new LwPolylineVertex(v117));
            line34.Vertexes.Add(new LwPolylineVertex(v84));
            line34.Vertexes[0].Bulge = Math.Tan(50 * pi / 180 / 4);
            fun.PolyFill(dxf, line34, 0.3, contour);

            LwPolyline line35 = new LwPolyline();
            line35.Vertexes.Add(new LwPolylineVertex(v118));
            line35.Vertexes.Add(new LwPolylineVertex(v119));
            line35.Vertexes[0].Bulge = Math.Tan(-77 * pi / 180 / 4);
            fun.PolyFill(dxf, line35, 0.3, contour);

            LwPolyline line36 = new LwPolyline();
            line36.Vertexes.Add(new LwPolylineVertex(v89));
            line36.Vertexes.Add(new LwPolylineVertex(v94));
            line36.Vertexes.Add(new LwPolylineVertex(v87));
            fun.PolyFill(dxf, line36, 0.3, contour);

            LwPolyline line37 = new LwPolyline();
            line37.Vertexes.Add(new LwPolylineVertex(v90));
            line37.Vertexes.Add(new LwPolylineVertex(v120));
            line37.Vertexes.Add(new LwPolylineVertex(v92));
            line37.Vertexes.Add(new LwPolylineVertex(v93));
            fun.PolyFill(dxf, line37, 0.1, contour);

            LwPolyline line38 = new LwPolyline();
            line38.Vertexes.Add(new LwPolylineVertex(v85));
            line38.Vertexes.Add(new LwPolylineVertex(v95));
            fun.PolyFill(dxf, line38, 0.3, contour);

            Vector2[] line39 = { v122, v123 };
            fun.drawBLine(dxf, line39, 0.3, contour);

            //4
            LwPolyline line40 = new LwPolyline();
            line40.Vertexes.Add(new LwPolylineVertex(v146));
            line40.Vertexes.Add(new LwPolylineVertex(v145));
            line40.Vertexes.Add(new LwPolylineVertex(v143));
            line40.Vertexes.Add(new LwPolylineVertex(v131));
            line40.Vertexes.Add(new LwPolylineVertex(v132));
            line40.Vertexes.Add(new LwPolylineVertex(v147));
            line40.Vertexes.Add(new LwPolylineVertex(v149));
            line40.Vertexes.Add(new LwPolylineVertex(v150));
            line40.Vertexes[1].Bulge = Math.Tan(75 * pi / 180 / 4);
            line40.Vertexes[5].Bulge = Math.Tan(75 * pi / 180 / 4);
            fun.PolyFill(dxf, line40, 0.3, contour);

            LwPolyline line41 = new LwPolyline();
            line41.Vertexes.Add(new LwPolylineVertex(v137));
            line41.Vertexes.Add(new LwPolylineVertex(v134));
            line41.Vertexes.Add(new LwPolylineVertex(v135));
            line41.Vertexes.Add(new LwPolylineVertex(v136));
            line41.Vertexes.Add(new LwPolylineVertex(v137));
            line41.Vertexes.Add(new LwPolylineVertex(v136));
            line41.Vertexes[4].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line41, 0.3, contour);

            LwPolyline line42 = new LwPolyline();
            line42.Vertexes.Add(new LwPolylineVertex(v141));
            line42.Vertexes.Add(new LwPolylineVertex(v140));
            line42.Vertexes.Add(new LwPolylineVertex(v139));
            line42.Vertexes.Add(new LwPolylineVertex(v142));
            line42.Vertexes.Add(new LwPolylineVertex(v141));
            line42.Vertexes.Add(new LwPolylineVertex(v142));
            line42.Vertexes[4].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line42, 0.3, contour);

            Line line43 = new Line(v127, v128);
            line43.Layer = centre;
            line43.Linetype = Linetype.DashDot;
            line43.LinetypeScale = 3;
            dxf.AddEntity(line43);

            Line line44 = new Line(v125, v126);
            line44.Layer = centre;
            line44.Linetype = Linetype.DashDot;
            line44.LinetypeScale = 3;
            dxf.AddEntity(line44);

            LwPolyline line45 = new LwPolyline();
            line45.Vertexes.Add(new LwPolylineVertex(v135));
            line45.Vertexes.Add(new LwPolylineVertex(v134));
            line45.Vertexes[0].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line45, 0.3, contour);

            LwPolyline line46 = new LwPolyline();
            line46.Vertexes.Add(new LwPolylineVertex(v139));
            line46.Vertexes.Add(new LwPolylineVertex(v140));
            line46.Vertexes[0].Bulge = Math.Tan(-40 * pi / 180 / 4);
            fun.PolyFill(dxf, line46, 0.3, contour);

            LwPolyline line47 = new LwPolyline();
            line47.Vertexes.Add(new LwPolylineVertex(v151));
            line47.Vertexes.Add(new LwPolylineVertex(v152));
            fun.PolyFill(dxf, line47, 0.3, contour);

            LwPolyline line48 = new LwPolyline();
            line48.Vertexes.Add(new LwPolylineVertex(v155));
            line48.Vertexes.Add(new LwPolylineVertex(v158));
            line48.Vertexes.Add(new LwPolylineVertex(v157));
            line48.Vertexes.Add(new LwPolylineVertex(v156));
            line48.Vertexes.Add(new LwPolylineVertex(v155));
            fun.PolyFill(dxf, line48, 0.3, contour);

            LwPolyline line49 = new LwPolyline();
            line49.Vertexes.Add(new LwPolylineVertex(v153));
            line49.Vertexes.Add(new LwPolylineVertex(v154));
            fun.PolyFill(dxf, line49, 0.3, contour);

            LwPolyline line50 = new LwPolyline();
            line50.Vertexes.Add(new LwPolylineVertex(v160));
            line50.Vertexes.Add(new LwPolylineVertex(v159));
            fun.PolyFill(dxf, line50, 0.3, contour);

            LwPolyline line51 = new LwPolyline();
            line51.Vertexes.Add(new LwPolylineVertex(v161));
            line51.Vertexes.Add(new LwPolylineVertex(v162));
            line51.Vertexes[0].Bulge = Math.Tan(125 * pi / 180 / 4);
            fun.PolyFill(dxf, line51, 0.3, contour);

            LwPolyline line52 = new LwPolyline();
            line52.Vertexes.Add(new LwPolylineVertex(v164));
            line52.Vertexes.Add(new LwPolylineVertex(v163));
            line52.Vertexes[0].Bulge = Math.Tan(125 * pi / 180 / 4);
            fun.PolyFill(dxf, line52, 0.3, contour);

            fun.drawcircle(dxf, v165, b5 / 2, 0.3, contour);

            fun.drawcircle(dxf, v165, b4 / 2, 0.3, contour);

            fun.drawcircle(dxf, v174, d9 / 2, 0.3, contour);

            LwPolyline line53 = new LwPolyline();
            line53.Vertexes.Add(new LwPolylineVertex(v170));
            line53.Vertexes.Add(new LwPolylineVertex(v167));
            line53.Vertexes.Add(new LwPolylineVertex(v168));
            line53.Vertexes.Add(new LwPolylineVertex(v169));
            line53.Vertexes.Add(new LwPolylineVertex(v170));
            line53.Vertexes.Add(new LwPolylineVertex(v167));
            line53.Vertexes[4].Bulge = Math.Tan(-180 * pi / 180 / 4);
            fun.PolyFill(dxf, line53, 0.3, contour);

            //5
            LwPolyline line54 = new LwPolyline();
            line54.Vertexes.Add(new LwPolylineVertex(v177));
            line54.Vertexes.Add(new LwPolylineVertex(v176));
            line54.Vertexes.Add(new LwPolylineVertex(v175));
            line54.Vertexes.Add(new LwPolylineVertex(v178));
            fun.PolyFill(dxf, line54, 0.3, contour);

            LwPolyline line55 = new LwPolyline();
            line55.Vertexes.Add(new LwPolylineVertex(v190));
            line55.Vertexes.Add(new LwPolylineVertex(v189));
            line55.Vertexes.Add(new LwPolylineVertex(v188));
            line55.Vertexes.Add(new LwPolylineVertex(v023));
            line55.Vertexes.Add(new LwPolylineVertex(v189));
            fun.PolyFill(dxf, line55, 0.01, contour);

            LwPolyline line56 = new LwPolyline();
            line56.Vertexes.Add(new LwPolylineVertex(v178));
            line56.Vertexes.Add(new LwPolylineVertex(v179));
            line56.Vertexes.Add(new LwPolylineVertex(v180));
            line56.Vertexes.Add(new LwPolylineVertex(v181));
            line56.Vertexes.Add(new LwPolylineVertex(v182));
            line56.Vertexes.Add(new LwPolylineVertex(v183));
            line56.Vertexes.Add(new LwPolylineVertex(v184));
            line56.Vertexes.Add(new LwPolylineVertex(v185));
            line56.Vertexes.Add(new LwPolylineVertex(v186));
            line56.Vertexes.Add(new LwPolylineVertex(v187));
            line56.Vertexes.Add(new LwPolylineVertex(v177));
            line56.Vertexes[0].Bulge = Math.Tan(-39 * pi / 180 / 4);
            line56.Vertexes[1].Bulge = Math.Tan(-32 * pi / 180 / 4);
            line56.Vertexes[2].Bulge = Math.Tan(33 * pi / 180 / 4);
            line56.Vertexes[3].Bulge = Math.Tan(-44 * pi / 180 / 4);
            line56.Vertexes[4].Bulge = Math.Tan(29 * pi / 180 / 4);
            line56.Vertexes[5].Bulge = Math.Tan(-44 * pi / 180 / 4);
            line56.Vertexes[6].Bulge = Math.Tan(26 * pi / 180 / 4);
            line56.Vertexes[7].Bulge = Math.Tan(-31 * pi / 180 / 4);
            line56.Vertexes[8].Bulge = Math.Tan(19 * pi / 180 / 4);
            line56.Vertexes[9].Bulge = Math.Tan(-42 * pi / 180 / 4);
            fun.PolyFill(dxf, line56, 0.1, contour);

            //6
            //LwPolyline line56 = new LwPolyline();
            //line56.Vertexes.Add(new LwPolylineVertex(v194));
            //line56.Vertexes.Add(new LwPolylineVertex(v195));
            //fun.PolyFill(dxf, line56, 0.01, centre);

            //LwPolyline line57 = new LwPolyline();
            //line57.Vertexes.Add(new LwPolylineVertex(v192));
            //line57.Vertexes.Add(new LwPolylineVertex(v193));
            //fun.PolyFill(dxf, line57, 0.01, centre);

            //LwPolyline line58 = new LwPolyline();
            //line58.Vertexes.Add(new LwPolylineVertex(v233));
            //line58.Vertexes.Add(new LwPolylineVertex(v234));
            //line58.Vertexes.Add(new LwPolylineVertex(v235));
            //line58.Vertexes.Add(new LwPolylineVertex(v236));
            //line58.Vertexes.Add(new LwPolylineVertex(v238));
            //line58.Vertexes.Add(new LwPolylineVertex(v239));
            //line58.Vertexes.Add(new LwPolylineVertex(v198));
            //line58.Vertexes.Add(new LwPolylineVertex(v197));
            //line58.Vertexes.Add(new LwPolylineVertex(v199));
            //line58.Vertexes.Add(new LwPolylineVertex(v200));
            //line58.Vertexes.Add(new LwPolylineVertex(v202));
            //line58.Vertexes.Add(new LwPolylineVertex(v203));
            //line58.Vertexes.Add(new LwPolylineVertex(v204));
            //fun.PolyFill(dxf, line58, 0.01, contour);



            //LwPolyline line59 = new LwPolyline();
            //line59.Vertexes.Add(new LwPolylineVertex(v204));
            //line59.Vertexes.Add(new LwPolylineVertex(v205));
            //line59.Vertexes.Add(new LwPolylineVertex(v206));
            //line59.Vertexes.Add(new LwPolylineVertex(v207));
            //line59.Vertexes.Add(new LwPolylineVertex(v208));
            //line59.Vertexes.Add(new LwPolylineVertex(v209));
            //line59.Vertexes.Add(new LwPolylineVertex(v210));
            //line59.Vertexes.Add(new LwPolylineVertex(v211));
            //line59.Vertexes.Add(new LwPolylineVertex(v212));
            //line59.Vertexes.Add(new LwPolylineVertex(v213));
            //line59.Vertexes.Add(new LwPolylineVertex(v214));
            //line59.Vertexes.Add(new LwPolylineVertex(v215));
            //line59.Vertexes.Add(new LwPolylineVertex(v216));
            //line59.Vertexes.Add(new LwPolylineVertex(v217));
            //line59.Vertexes.Add(new LwPolylineVertex(v218));
            //line59.Vertexes.Add(new LwPolylineVertex(v219));
            //line59.Vertexes.Add(new LwPolylineVertex(v220));
            //line59.Vertexes.Add(new LwPolylineVertex(v221));
            //line59.Vertexes.Add(new LwPolylineVertex(v222));
            //line59.Vertexes.Add(new LwPolylineVertex(v223));
            //line59.Vertexes.Add(new LwPolylineVertex(v224));
            //line59.Vertexes.Add(new LwPolylineVertex(v225));
            //line59.Vertexes.Add(new LwPolylineVertex(v226));
            //line59.Vertexes.Add(new LwPolylineVertex(v227));
            //line59.Vertexes.Add(new LwPolylineVertex(v228));
            //line59.Vertexes.Add(new LwPolylineVertex(v229));
            //line59.Vertexes.Add(new LwPolylineVertex(v230));
            //line59.Vertexes.Add(new LwPolylineVertex(v231));
            //line59.Vertexes.Add(new LwPolylineVertex(v233));
            //line59.Vertexes[0].Bulge = Math.Tan(75 * pi / 180 / 4);
            //line59.Vertexes[2].Bulge = Math.Tan(-161 * pi / 180 / 4);
            //line59.Vertexes[3].Bulge = Math.Tan(31 * pi / 180 / 4);
            //line59.Vertexes[4].Bulge = Math.Tan(-45 * pi / 180 / 4);
            //line59.Vertexes[5].Bulge = Math.Tan(56 * pi / 180 / 4);
            //line59.Vertexes[6].Bulge = Math.Tan(-65 * pi / 180 / 4);
            //line59.Vertexes[7].Bulge = Math.Tan(51 * pi / 180 / 4);
            //line59.Vertexes[8].Bulge = Math.Tan(-37 * pi / 180 / 4);
            //line59.Vertexes[9].Bulge = Math.Tan(44 * pi / 180 / 4);
            //line59.Vertexes[10].Bulge = Math.Tan(-31 * pi / 180 / 4);
            //line59.Vertexes[11].Bulge = Math.Tan(55 * pi / 180 / 4);
            //line59.Vertexes[12].Bulge = Math.Tan(-66 * pi / 180 / 4);
            //line59.Vertexes[13].Bulge = Math.Tan(32 * pi / 180 / 4);
            //line59.Vertexes[14].Bulge = Math.Tan(-46 * pi / 180 / 4);
            //line59.Vertexes[15].Bulge = Math.Tan(45 * pi / 180 / 4);
            //line59.Vertexes[16].Bulge = Math.Tan(-46 * pi / 180 / 4);
            //line59.Vertexes[17].Bulge = Math.Tan(49 * pi / 180 / 4);
            //line59.Vertexes[18].Bulge = Math.Tan(-43 * pi / 180 / 4);
            //line59.Vertexes[19].Bulge = Math.Tan(40 * pi / 180 / 4);
            //line59.Vertexes[20].Bulge = Math.Tan(-45 * pi / 180 / 4);
            //line59.Vertexes[21].Bulge = Math.Tan(10 * pi / 180 / 4);
            //line59.Vertexes[22].Bulge = Math.Tan(5 * pi / 180 / 4);
            //line59.Vertexes[23].Bulge = Math.Tan(-16 * pi / 180 / 4);
            //line59.Vertexes[24].Bulge = Math.Tan(17 * pi / 180 / 4);
            //line59.Vertexes[25].Bulge = Math.Tan(-46 * pi / 180 / 4);
            //line59.Vertexes[27].Bulge = Math.Tan(75 * pi / 180 / 4);
            //fun.PolyFill(dxf, line59, 0.01, contour);

            //LwPolyline line60 = new LwPolyline();
            //line60.Vertexes.Add(new LwPolylineVertex(v245));
            //line60.Vertexes.Add(new LwPolylineVertex(v246));
            //line60.Vertexes.Add(new LwPolylineVertex(v247));
            //line60.Vertexes.Add(new LwPolylineVertex(v244));
            //fun.PolyFill(dxf, line60, 0.01, contour);

            //LwPolyline line61 = new LwPolyline();
            //line61.Vertexes.Add(new LwPolylineVertex(v246));
            //line61.Vertexes.Add(new LwPolylineVertex(v251));
            //line61.Vertexes.Add(new LwPolylineVertex(v248));
            //line61.Vertexes.Add(new LwPolylineVertex(v247));
            //fun.PolyFill(dxf, line61, 0.01, contour);

            //Arc arc2 = new Arc(v252, v251.X - v252.X, 0, 180);
            //arc2.Layer = contour;
            //arc2.Lineweight = Lineweight.W25;
            //dxf.AddEntity(arc2);

            //Arc arc3 = new Arc(v249, v251.X - v252.X, 180, 0);
            //arc3.Layer = contour;
            //arc3.Lineweight = Lineweight.W25;
            //dxf.AddEntity(arc3);

            //LwPolyline line62 = new LwPolyline();
            //line62.Vertexes.Add(new LwPolylineVertex(v256));
            //line62.Vertexes.Add(new LwPolylineVertex(v257));
            //line62.Vertexes.Add(new LwPolylineVertex(v254));
            //line62.Vertexes.Add(new LwPolylineVertex(v255));
            //line62.Vertexes.Add(new LwPolylineVertex(v253));
            //line62.Vertexes.Add(new LwPolylineVertex(v250));
            //line62.Vertexes.Add(new LwPolylineVertex(v257));
            //fun.PolyFill(dxf, line62, 0.01, contour);

            //LwPolyline line63 = new LwPolyline();
            //line63.Vertexes.Add(new LwPolylineVertex(v264));
            //line63.Vertexes.Add(new LwPolylineVertex(v265));
            //line63.Vertexes.Add(new LwPolylineVertex(v266));
            //line63.Vertexes.Add(new LwPolylineVertex(v264));
            //line63.Vertexes.Add(new LwPolylineVertex(v263));
            //line63.Vertexes.Add(new LwPolylineVertex(v262));
            //line63.Vertexes.Add(new LwPolylineVertex(v265));
            //fun.PolyFill(dxf, line63, 0.01, contour);

            //LwPolyline line64 = new LwPolyline();
            //line64.Vertexes.Add(new LwPolylineVertex(v240));
            //line64.Vertexes.Add(new LwPolylineVertex(v241));
            //line64.Vertexes.Add(new LwPolylineVertex(v242));
            //line64.Vertexes.Add(new LwPolylineVertex(v243));
            //line64.Vertexes.Add(new LwPolylineVertex(v241));
            //fun.PolyFill(dxf, line64, 0.01, contour);=-

            //LwPolyline line65 = new LwPolyline();
            //line65.Vertexes.Add(new LwPolylineVertex(v258));
            //line65.Vertexes.Add(new LwPolylineVertex(v260));
            //line65.Vertexes.Add(new LwPolylineVertex(v261));
            //line65.Vertexes.Add(new LwPolylineVertex(v259));
            //fun.PolyFill(dxf, line65, 0.01, contour);

            //LwPolyline line66 = new LwPolyline();
            //line66.Vertexes.Add(new LwPolylineVertex(v270));
            //line66.Vertexes.Add(new LwPolylineVertex(v269));
            //line66.Vertexes.Add(new LwPolylineVertex(v271));
            //line66.Vertexes.Add(new LwPolylineVertex(v270));
            //line66.Vertexes.Add(new LwPolylineVertex(v267));
            //line66.Vertexes.Add(new LwPolylineVertex(v268));
            //line66.Vertexes.Add(new LwPolylineVertex(v269));
            //fun.PolyFill(dxf, line66, 0.01, contour);

            //标注线
            LwPolyline line01 = new LwPolyline();
            line01.Vertexes.Add(new LwPolylineVertex(v04));
            line01.Vertexes.Add(new LwPolylineVertex(v05));
            fun.PolyFill(dxf, line01, 0.1, dimensioning);

            LwPolyline line02 = new LwPolyline();
            line02.Vertexes.Add(new LwPolylineVertex(v07));
            line02.Vertexes.Add(new LwPolylineVertex(v08));
            fun.PolyFill(dxf, line02, 0.1, dimensioning);

            LwPolyline line03 = new LwPolyline();
            line03.Vertexes.Add(new LwPolylineVertex(v016));
            line03.Vertexes.Add(new LwPolylineVertex(v017));
            fun.PolyFill(dxf, line03, 0.1, dimensioning);


            //填充
            LwPolyline hatchpoly1 = new LwPolyline();
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v90));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v120));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v92));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v93));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v87));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v94));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v89));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v90));
            hatchpoly1.IsClosed = true;
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)hatchpoly1.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)hatchpoly1.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

            LwPolyline hatchpoly2 = new LwPolyline();
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v190));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v189));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v188));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v178));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v179));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v180));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v181));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v182));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v183));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v184));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v185));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v186));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v187));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v177));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v190));
            hatchpoly2.Vertexes[3].Bulge = Math.Tan(-39 * pi / 180 / 4);
            hatchpoly2.Vertexes[4].Bulge = Math.Tan(-32 * pi / 180 / 4);
            hatchpoly2.Vertexes[5].Bulge = Math.Tan(33 * pi / 180 / 4);
            hatchpoly2.Vertexes[6].Bulge = Math.Tan(-44 * pi / 180 / 4);
            hatchpoly2.Vertexes[7].Bulge = Math.Tan(29 * pi / 180 / 4);
            hatchpoly2.Vertexes[8].Bulge = Math.Tan(-44 * pi / 180 / 4);
            hatchpoly2.Vertexes[9].Bulge = Math.Tan(26 * pi / 180 / 4);
            hatchpoly2.Vertexes[10].Bulge = Math.Tan(-31 * pi / 180 / 4);
            hatchpoly2.Vertexes[11].Bulge = Math.Tan(19 * pi / 180 / 4);
            hatchpoly2.Vertexes[12].Bulge = Math.Tan(-42 * pi / 180 / 4);
            hatchpoly2.IsClosed = true;
            String[] htype2 = new String[100];
            Line[] hline2 = new Line[100];
            Arc[] harc2 = new Arc[100];
            int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多
                                                       //
                                                       //少
            for (int i = 0; i < hnumst2; i++)
            {
                htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype2[i] == "Line")
                {
                    hline2[i] = (Line)hatchpoly2.Explode()[i];
                }
                if (htype2[i] == "Arc")
                {
                    harc2[i] = (Arc)hatchpoly2.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype2, hnumst2, 45, 10, hline2, harc2, hatching);

            //标注样式
            //箭头样式
            DimensionStyle dimensionStyle = fun.CreateDimStyle();
            dimensionStyle.ArrowSize = 1;
            dimensionStyle.ExtLineExtend = 0.6;//标注延长线长度/2
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
            dimensionStyle.TextHeight = 1;
            double offset = 10;

            //文本样式
            dimensionStyle.TextHeight = 2;


            double height = 2;
            double arrowsize = 1;
            double exline = 2;

            //1
            fun.jt(dxf, v06, 180, 11, 20, "");

            fun.jt(dxf, v09, 180, 11, 20, "");

            fun.jt(dxf, v010, 70, 11, 20, "");

            fun.jt(dxf, fun.Polar(v5, -90 * pi / 180, 10), 90, 10, 20, "");

            LinearDimension dim1 = new LinearDimension(new Line(v03, v02), d1 * 3 / 2, 180, dimensionStyle);
            dim1.UserText = "d1=" + Math.Round(d1 * scale, 1);
            dxf.AddEntity(dim1);

            LinearDimension dim2 = new LinearDimension(new Line(v01, v1), (d1 / 2 + 2) / Math.Sin(45 * pi / 180) + d1 / 9, -90, dimensionStyle);
            dim2.UserText = "h1=" + Math.Round(h1 * scale, 1);
            dxf.AddEntity(dim2);


            fun.jdbz1(dxf, new Line(v5, fun.Polar(v5, -90 * pi / 180, 0.1)), new Line(v5, fun.Polar(v5, -135 * pi / 180, 0.1)), 30, "45°", 5);

            fun.jdbz1(dxf, new Line(v3, fun.Polar(v3, 45 * pi / 180, 0.1)), new Line(v3, fun.Polar(v3, -45 * pi / 180, 0.1)), 30, "90°", 5);

            fun.jdbz1(dxf, new Line(v2, fun.Polar(v2, 135 * pi / 180, 0.1)), new Line(v2, fun.Polar(v2, -135 * pi / 180, 0.1)), 30, "90°", 5);

            fun.jdbz1(dxf, new Line(v6, fun.Polar(v6, 135 * pi / 180, 0.1)), new Line(v6, fun.Polar(v6, 45 * pi / 180, 0.1)), 30, "90°", 5);

            fun.gcbz(dxf, (fun.Polar(v37, -46 * pi / 180, 2)), 10, 46, 7, 0, 8, 1, 1, "C", "0.1/50", 2, "qxd", 1);



            //2
            LinearDimension dim3 = new LinearDimension(new Line(v44, v011), (d1 - d3) / 8, -45, dimensionStyle);
            dim3.UserText = "l6=" + Math.Round(l6 * scale, 1);
            dxf.AddEntity(dim3);

            LinearDimension dim4 = new LinearDimension(new Line(v014, v013), d1 + d1 * 0.4, 45, dimensionStyle);
            dim4.UserText = "b1=" + Math.Round(b1 * scale, 1) + "/" + "b3=" + Math.Round(b3 * scale, 1);
            dxf.AddEntity(dim4);

            LinearDimension dim5 = new LinearDimension(new Line(v012, v015), d1 + d1 * 0.6, 45, dimensionStyle);
            dim5.UserText = "b1(2×)=" + Math.Round(b1 * scale, 1);
            dxf.AddEntity(dim5);

            fun.dimrot1(dxf, v65, v66, 135, l3, 1, height, arrowsize, exline, "" , "", "");

            fun.dimrot1(dxf, v59, v60, -45, l3, 1, height, arrowsize, exline, "", "", "");

            fun.gcbz(dxf, (fun.Polar(v65, -135 * pi / 180, l3)), 10, 135, 7, 180, 8, 1, 1, "E", "0.1", 2, "wzd", 1);

            fun.gcbz(dxf, (fun.Polar(v015, 135 * pi / 180, d1 + d1 * 0.6)), 10, 45, 7, 0, 8, 1, 1, "B", "0.5", 2, "dcd", 1);

            fun.gcbz(dxf, (fun.Polar(v59, 45 * pi / 180, l3)), 10, 135, 7, 0, 8, 1, 1, "B", "0.1/0.5", 2, "czd", 1);


            //3
            LinearDimension dim6 = new LinearDimension(new Line(v018, v80), (v109.Y - v108.Y) / 2, 0, dimensionStyle);
            dim6.UserText = "l3=" + Math.Round(l3 * scale, 1);
            dxf.AddEntity(dim6);

            LinearDimension dim7 = new LinearDimension(new Line(v80, v106), v109.Y - v108.Y, 0, dimensionStyle);
            dim7.UserText = "l1=" + Math.Round(l1 * scale, 1);
            dxf.AddEntity(dim7);

            LinearDimension dim8 = new LinearDimension(new Line(v85, v86), v109.Y - v108.Y, 0, dimensionStyle);
            dim8.UserText = "l4=" + Math.Round(l4 * scale, 1);
            dxf.AddEntity(dim8);


            LinearDimension dim9 = new LinearDimension(new Line(v85, v75), 20, -90, dimensionStyle);
            dim9.UserText = "1°26'21''±25''";
            dxf.AddEntity(dim9);

            LinearDimension dim10 = new LinearDimension(new Line(v87, v81), v109.Y - v108.Y, 180, dimensionStyle);
            dim10.UserText = "l2=" + Math.Round(l2 * scale, 1);
            dxf.AddEntity(dim10);

            //4
            LinearDimension dim11 = new LinearDimension(new Line(v019, v020), l3 * 2, -90, dimensionStyle);
            dim11.UserText = "b4=" + Math.Round(b4 * scale, 1);
            dxf.AddEntity(dim11);

            LinearDimension dim12 = new LinearDimension(new Line(v021, v022), l3 * 2, 0, dimensionStyle);
            dim12.UserText = "b5=" + Math.Round(b5 * scale, 1);
            dxf.AddEntity(dim12);

            //5
            LinearDimension dim13 = new LinearDimension(new Line(v177, v189), l4 / Math.Cos(30 * pi / 180) * 12, 0, dimensionStyle);
            dim13.UserText = "l5=" + Math.Round(l5 * scale, 1);
            dxf.AddEntity(dim13);

            fun.jdbz1(dxf, new Line(v189, fun.Polar(v189, -135 * pi / 180, 0.1)), new Line(v189, fun.Polar(v189, -90 * pi / 180, 0.1)), 30, "45°", 5);


            //定义格式，路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);


        }

    }
}
